#pragma once

#include <string>
#include <vector>
#include <map>
#include <iostream>

#include "parsetree.h"

using std::vector;
using std::string;
using std::map;
using namespace Thinder;

struct Symbol 
{
    enum SymbolType { Var, Func, Class, Constructor, Operator, Link };
    string internal;
    ParseTree::Type type;
    SymbolType symbolType;
    vector<ParseTree::Modifier> modifiers;
    vector<ParseTree::Type> argumentTypes;
    ParseTree::Name linkTo;
};

namespace Thinder {
typedef map<ParseTree::Name, Symbol> SymbolTable;
}

string printSymbol(Symbol s);
Thinder::SymbolTable buildSymbolTable(ParseTree::Thinder &thinder);
string printSymbolTable(Thinder::SymbolTable s);
string printName(ParseTree::Name name);
string printType(ParseTree::Type type);
ParseTree::Type nameToType(ParseTree::Name name);
Thinder::SymbolTable parseSymbolTable(string input);
void mergeSymbolTable(Thinder::SymbolTable &s1, Thinder::SymbolTable &s2);
void addSymlink(Thinder::SymbolTable &s, ParseTree::Name target, ParseTree::Name link_name);

